package main

import "fmt"

func main() {
	sn1 := struct {
		age  int
		name string
	}{age: 11, name: "qq"}
	sn2 := struct {
		age  int
		name string
	}{age: 11, name: "qq"}
	if sn1 == sn2 {
		fmt.Println("sn1== sn2")
	}
	sm1 := struct {
		age int
		m   map[string]string
	}{age: 11, m: map[string]string{"a": "1"}}
	sm2 := struct {
		age int
		m   map[string]string
	}{age: 11, m: map[string]string{"a": "1"}}
	//sm1 和 sm2 无法比较， 因为结构体内有无法比较的类型
	if sm1 == sm2 {
		fmt.Println("sm1== sm2")
	}

	a := 1
	b := 2
	sp1 := struct {
		age  int
		data *int
	}{age: 11, data: &a}
	sp2 := struct {
		age  int
		data *int
	}{age: 11, data: &b}

	if sp1 == sp2 {
		fmt.Println("sp1== sp2")
	}

	sn3 := struct {
		name string
		age  int
	}{age: 11, name: "qq"}

	//顺序不同无法比较
	if sn1 == sn3 {
		fmt.Println("sn1== sn3")
	}

	sn4 := struct {
		sex int
		age int
	}{sex: 1, age: 23}

	//类型不同无法比较
	if sn4 == sn3 {
		fmt.Println("sn4== sn3")
	}

	spch1 := struct {
		age int
		ch  chan int
	}{age: 11, ch: nil}

	spch2 := struct {
		age int
		ch  chan int
	}{age: 11, ch: nil}

	if spch1 == spch2 {
		fmt.Println("spch1 == spch2")
	}

	spi1 := struct {
		age int
		it  interface{}
	}{age: 11, it: nil}

	spi2 := struct {
		age int
		it  interface{}
	}{age: 11, it: nil}

	if spi1 == spi2 {
		fmt.Println("spi1 == spi2")
	}

	sps1 := struct {
		age  int
		jobs []string
	}{age: 11, jobs: nil}

	sps2 := struct {
		age  int
		jobs []string
	}{age: 11, jobs: nil}

	if sps1 == sps2 {
		fmt.Println("sps1 == sps2")
	}
}
